From 1c6e2151f2ad616b497c4d7f8b71d366b975852b Mon Sep 17 00:00:00 2001 From: Clark Gaebel Date: Fri, 12 Dec 2014 12:54:14 -0800 Subject: [PATCH] Add support for a custom arguments list when running main. --- src/cargo/lib.rs | 14 ++++++++++++++ src/cargo/sources/path.rs | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs index e2b99336e..2dd20824f 100644 --- a/src/cargo/lib.rs +++ b/src/cargo/lib.rs @@ -116,6 +116,20 @@ pub fn execute_main_without_stdin<'a, options_first)); } +pub fn execute_main_with_args_and_without_stdin<'a, + T: Decodable, + V: Encodable, io::IoError>>( + exec: fn(T, &mut MultiShell) -> CliResult>, + options_first: bool, + usage: &str, + args: &[String]) { + let mut shell = shell(true); + + process_executed( + call_main_without_stdin(exec, &mut shell, usage, args, options_first), + &mut shell) +} + pub fn call_main_without_stdin<'a, T: Decodable, V: Encodable, io::IoError>>( diff --git a/src/cargo/sources/path.rs b/src/cargo/sources/path.rs index 731e4835e..d6a012fc5 100644 --- a/src/cargo/sources/path.rs +++ b/src/cargo/sources/path.rs @@ -51,7 +51,7 @@ impl PathSource { } } - fn read_packages(&self) -> CargoResult> { + pub fn read_packages(&self) -> CargoResult> { if self.updated { Ok(self.packages.clone()) } else { -- 2.30.2